﻿using System.Windows;
using Garfield.Core;
using Garfield.Core.Runtime;
using Garfield.Presentation.Markup;

namespace Garfield.Presentation
{
    [Plugin("Garfield.Presentation")]
    public sealed class PresentationPlugin : Plugin
    {
        public const string VIEW_PARTS = "Garfield.Presentation.ViewParts";
        public const string WINDOW_CHROMES = "Garfield.Presentation.WindowChromes";

        public static readonly ExtensionPoint<string, UIElement> ViewParts = DeclareExtensionPoint<string, UIElement>(typeof(PresentationPlugin), VIEW_PARTS, false);

        public static readonly ExtensionPoint<string, Window> WindowChromes = DeclareExtensionPoint<string, Window>(typeof(PresentationPlugin), WINDOW_CHROMES, false);

        protected override void Initialize()
        {
        }

        public override void Start(IServiceLocator serviceLocator)
        {
            MarkupExtensionBase.ServiceLocator = serviceLocator;
        }

        public override void Stop(IServiceLocator serviceLocator)
        {
            MarkupExtensionBase.ServiceLocator = null;
        }
    }
}
